import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home/Home.vue'
import Login from '@/views/login/Login.vue'
import Page from '@/views/page/Page.vue'
import pageDetail from '@/views/page/pageDetail.vue'
import NotFound from '@/components/NotFound'
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return routerPush.call(this, location).catch(error => error)
}

Vue.use(VueRouter)

const SendPaySlip = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/SendPaySlip.vue')
const PaySlipManagement = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PaySlipManagement.vue')
const PreviewPaySlip = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PreviewPaySlip.vue')
const PaySlipSetting = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PaySlipSetting.vue')
const Appointment = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/Appointment.vue')
const Appointment1 = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/Appointment1.vue')
const AppointmentReview = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/AppointmentReview.vue')
const AppointmentDetails = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/AppointmentDetails.vue')
const WorkMoudle = () =>
	import( /* webpackChunkName: "work" */ '@/views/work/WorkMoudle.vue')
const CheckAgent = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/CheckAgent.vue')
const ViewDone = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ViewDone.vue')
const ViewAppointment = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ViewAppointment.vue')
const NewManagement = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/NewManagement.vue')
const ThingsManagement = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ThingsManagement.vue')
const ThingsManagement1 = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ThingsManagement1.vue')
const ThingsManagementDetail = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ThingsManagementDetail.vue')
const NewManagementDetail = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/NewManagementDetail.vue')
const ViewRoomDetail = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ViewRoomDetail.vue')
const ViewDetail = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/ViewDetail.vue')

const routes = [{ //404
		path: '*',
		component: NotFound,
		name: 'Notfound',
		meta: {
			title: '404'
		}
	},
	{ // 首页重定向 home
		path: '/',
		redirect: '/home'
	},
	{ // 首页 home
		path: '/home',
		name: 'Home',
		component: Home,
		meta: {
			title: '首页'
		}
	},
	{ // 登录 login
		path: '/login',
		name: 'Login',
		component: Login,
		meta: {
			title: '登录'
		}
	},
	{ // 表格 page
		path: '/page',
		name: 'Page',
		component: Page,
		meta: {
			title: '表格'
		}
	},
	{ // 表格详情 pageDetail
		path: '/page/pageDetail',
		name: 'pageDetail',
		component: pageDetail,
		meta: {
			title: '表格详情'
		}
	},
	{ // 发工资条 sendPaySlip
		path: '/sendPaySlip',
		name: 'SendPaySlip',
		component: SendPaySlip,
		meta: {
			title: '发工资条',
			requiresAuth: true
		}
	},
	{ // 工资条管理 paySlipManagement
		path: '/paySlipManagement',
		name: 'PaySlipManagement',
		component: PaySlipManagement,
		meta: {
			title: '工资条管理',
			requiresAuth: true
		}
	},
	{ // 工资条详情 PreviewPaySlip
		path: '/paySlipManagement/PreviewPaySlip/:id',
		name: 'PreviewPaySlip',
		component: PreviewPaySlip,
		meta: {
			title: '工资条详情',
			requiresAuth: true,
			activeLabel: '工资条管理',
			activeMenu: '/paySlipManagement'
		}
	},
	{ // 工资条设置 paySlipSetting
		path: '/paySlipSetting',
		name: 'PaySlipSetting',
		component: PaySlipSetting,
		meta: {
			title: '工资条设置',
			requiresAuth: true
		}
	},
	{ // 功能模块 workMoudle
		path: '/workMoudle',
		name: 'WorkMoudle',
		component: WorkMoudle,
		meta: {
			title: '功能模块',
			requiresAuth: true
		}
	},
	{ // 场馆预约 appointment
		path: '/appointment',
		name: 'Appointment',
		component: Appointment,
		meta: {
			title: '场馆预约-展示',
			requiresAuth: true
		}
	},
	{
		path: '/appointment1',
		name: 'Appointment1',
		component: Appointment1,
		meta: {
			title: '场馆预约-可预约',
			requiresAuth: true
		}
	},
	{ // 预约审核 appointmentReview
		path: '/appointmentReview',
		name: 'AppointmentReview',
		component: AppointmentReview,
		meta: {
			title: '预约审核',
			requiresAuth: true
		}
	},
	{ // 预约详情 appointmentDetails
		path: '/appointmentDetails',
		name: 'AppointmentDetails',
		component: AppointmentDetails,
		meta: {
			title: '预约详情',
			requiresAuth: true
		},
	},
	{ // 查看当前待办任务 CheckAgent
		path: '/checkAgent',
		name: 'CheckAgent',
		component: CheckAgent,
		meta: {
			title: '查看当前待办任务',
			requiresAuth: true
		}
	},
	{ // 查看已办任务 ViewDone
		path: '/viewDone',
		name: 'ViewDone',
		component: ViewDone,
		meta: {
			title: '查看已办任务',
			requiresAuth: true
		}
	},
	{ // 查看已经预约的信息 ViewAppointment
		path: '/viewAppointment',
		name: 'ViewAppointment',
		component: ViewAppointment,
		meta: {
			title: '查看预约',
			requiresAuth: true
		}
	},
	{
		// 场管预约管理新增 NewManagement
		path: '/newManagement',
		name: 'NewManagement',
		component: NewManagement,
		meta: {
			title: '场管预约-新增',
			requiresAuth: true
		}
	},
	{
		// 事物管理 ThingsManagement
		path: '/thingsManagement',
		name: 'ThingsManagement',
		component: ThingsManagement,
		meta: {
			title: '事物管理-新增',
			requiresAuth: true
		}
	},
	{
		// 事物管理 ThingsManagement1
		path: '/thingsManagement1',
		name: 'ThingsManagement1',
		component: ThingsManagement1,
		meta: {
			title: '事物管理-修改',
			requiresAuth: true
		}
	},
	{
		// 事管列表 ThingsManagementDetail
		path: '/thingsManagementDetail',
		name: 'ThingsManagementDetail',
		component: ThingsManagementDetail,
		meta: {
			title: '事管列表',
			requiresAuth: true
		}
	},
	{
		// 预约修改详情页 NewManagementDetail
		path: '/newManagementDetail',
		name: 'NewManagementDetail',
		component: NewManagementDetail,
		meta: {
			title: '预约修改详情页',
			requiresAuth: true
		}
	},
	{
		// 查看房间预约详情 ViewRoomDetail
		path: '/viewRoomDetail',
		name: 'ViewRoomDetail',
		component: ViewRoomDetail,
		meta: {
			title: '房间预约详情',
			requiresAuth: true
		}
	},
	{
		// 房间预约 ViewDetail
		path: '/viewDetail',
		name: 'ViewDetail',
		component: ViewDetail,
		meta: {
			title: '房间预约',
			requiresAuth: true
		}
	},
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router